package com.paul;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;
import org.springframework.core.env.Environment;

import com.alibaba.dubbo.config.spring.context.annotation.DubboComponentScan;


//@DubboComponentScan(basePackages = "com.paul.service")
@SpringBootApplication
public class ProviderTestApp {

	private static Logger logger = LoggerFactory.getLogger(ProviderTestApp.class);
	
	public static void main(String[] args) {
		SpringApplication app = new SpringApplication(ProviderTestApp.class);
		ApplicationContext ctx = app.run(args);
		
		Environment env = ctx.getEnvironment();
		startDaemonAwaitThread();
		logger.info("启动成功...");
	}
	
	//等待线程
	public static void startDaemonAwaitThread() {
		Thread awaitThread = new Thread("container") {

			@Override
			public void run() {
				while (true) {
					try {
						Thread.sleep(10000);
					} catch (InterruptedException ex) {
					}
				}
			}

		};
		awaitThread.setContextClassLoader(ProviderTestApp.class.getClassLoader());
		awaitThread.setDaemon(false);
		awaitThread.start();
	}
}
